import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path"

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": resolve(__dirname, "./src")
    }
  },
  server:{
    host: '0.0.0.0', //解决“vite use `--host` to expose”
    port: 8081,
    hmr: true,
    open: true,
    proxy: {
      '/api': {
        target: 'http://localhost:9000/',	//接口地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '') // 重写路径
      }
    }
  }
})
